package com.tedu.ioc;


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public class dept {
    List<Bean> list = new ArrayList<>();
    ConcurrentHashMap<String,Object> map=new ConcurrentHashMap<>();
    public dept()throws Exception {
        Bean b = new Bean("user", "com.tedu.ioc.user");
        list.add(b);
        Init();

    }

    private void Init()throws Exception {
        for (Bean b : list) {
            String k=b.getName();
            Object v=Class.forName(b.getPath()).newInstance();
            map.put(k,v);
        }
    }

    public Object getBean(String key){
        return map.get(key);
    }
}
